#ifndef DAEMON_COMMON_H
#define DAEMON_COMMON_H

#include "ProductManager.h"
#include "IPCAM_Export.h"
#include "Daemon_GetNetInfo.h"
#include "Daemon_BoardVersion.h"
#include <sys/prctl.h>

#define SET_THREAD_NAME(name) (prctl(PR_SET_NAME, (unsigned long)name))


#define FILE_MODE_READ       		"r"
//#define PATH_MOUNT_SD       	 	"/mnt/mmc"
#define PATH_MOUNT_INFO      	 	"/proc/mounts"

#define PROGRAM_IPCAM       	 	"ipcam"
#define BSP_FIFO             		"/tmp/bspfifo"
#define PROGRAM_IPCAM_STARTSH       "/app/start.sh"
#define PROGRAM_IPCAM_UPDATE_FLAG   "/tmp/update_flag"
#define PATH_VERSION		 		"/app/ipcam/verinfo"
#define PATH_UPDATE_VERSION			"ipcam/verinfo"
#define PATH_TEMP					"/tmp/ttemp"
#define PROGRAM_WPA_SPUPLICANT      "/app/bin/wpa_supplicant"

#define PROGRAM_UDHCPC              "udhcpc -i wlan0"

#define DEFAULT_WPAFILE_PATH		"/mnt/mtd/Config/wpa_supplicant.conf"


CHAR *CompareVer(CHAR *Version1, CHAR *Version2);

CHAR *CmpVersion(CHAR *SrcPath, CHAR *DestPath, CHAR *Type);
CHAR *UpgradeApp(CHAR *SrcPath, CHAR *Type);
	
INT IsFileExist(CHAR *PATH);
int Is_SPI_Falsh();
INT IsMount(CHAR *pPathDev);
BOOL Daemon_CheckProgram(CHAR * ProgramName);
VOID Daemon_UpGrade(CHAR *SrcPath, CHAR * DestPath, CHAR * FileName);
VOID *Pthread_FifoMonitor(VOID *args);
/*
	函数使用说明：
	返回值：
	0 ：正常结束
	-1：输入命令无效
	-2：调用 popen失败
	-3：调用 pclose失败
	-4: 子进程是因为信号而结束
    -5: 子进程处于暂停执行
    -6: 命令运行失败
*/
int hi_system(char *cmd);
void rt_system(const char* cmd);
int GetPidByName(char* task_name);

#endif  //DAEMON_COMMON_H

